package com.itheima.多态.多态的好处_04;

//测试类
public class Demo {
    public static void main(String[] args) {
        //1.创建一个饲养员对象
        AnimalOperator operator = new AnimalOperator();
        //2. 指挥饲养员喂狗吃饭
        operator.useAnimal(new Dog());
        //3. 指挥饲养员喂猫吃饭
        operator.useAnimal(new Cat());
        //4. 指挥饲养员喂猪吃饭
        operator.useAnimal(new Pig());
        //5. 指挥饲养员喂猴吃饭
        operator.useAnimal(new Monkey());

        Animal animal = operator.getAnimal();
        animal.eat();
    }
}
